/*
 * @lc app=leetcode.cn id=187 lang=cpp
 *
 * [187] 重复的DNA序列
 */

// @lc code=start
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
    vector<string> findRepeatedDnaSequences(string s) {
        if(s.length() <= 10) return {};
        map<string, int> ans;
        for(int i = 0; i <= s.size() - 10; i++)
        {
            ans[s.substr(i, 10)]++;
        }

        vector<string> res;
        for(auto& it:ans)
        {
            if(it.second > 1)
            {
                res.push_back(it.first);
            }
        }
        return res;
    }
};
// @lc code=end

